TGML Value Conversion: <ConvertValue>
ConvertValue specifies how a server variable (signal) value is to be converted to a TGML element attribute value. A ConvertValue element belongs to the immediate parent Bind element.
A ConvertValue rule is only executed when each of the specified conditions is fulfilled.
Example of a ConvertValue element where the attribute is set to #00FF00 (green) when the signal value is more than 18 and less than or equal to 22:
<Bind Name="Temperature" Attribute="Fill">
<ConvertValue AttributeValue="#00FF00"
SignalMoreThan="18.0" SignalLessOrEqualTo="22.0"/>
</Bind>
An example rule that can never be fulfilled (and thus, never executed) since the signal value is both equal to 0 and more than 10:
<ConvertValue Name="Bad Rule" AttributeValue="#FF0000" SignalEqualTo="0" SignalMoreThan="l0"/>
Attribute | Type | Description |
---|---|---|
AttributeValue |
String (untyped) |
The attribute value that is to be set (resulting value). The type is determined by the bound Attribute (referenced by the Bind element). |
SignalEqualTo |
String (untyped) |
Corresponds to "=" |
SignalMoreThan |
String (untyped) |
Corresponds to ">" |
SignalMoreOrEqualTo |
String (untyped) |
Corresponds to ">=" |
SignalLessThan |
String (untyped) |
Corresponds to "<" |
SignalLessOrEqualTo |
String (untyped) |
Corresponds to "<=" |
Example of a SignalEqualTo ConvertValue element:
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0" Stroke="#000000" Fill="#000000">
<Bind Name="State" Attribute="Fill">
<ConvertValue AttributeValue="#00FF00" SignalEqualTo="l"/>
<ConvertValue AttributeValue="#FF0000" SignalEgualTo="0"/>
</Bind>
</Polygon>
</TGML>
Example of a SignalEqualTo ConvertValue element on screen:
Example of other ConvertValue elements:
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0" Stroke="#000000" Fill="#000000">
<Bind Name="Temperature" Attribute="Fill">
<ConvertValue AttributeValue="#0000FF" SignalLessThan="18.0"/>
<ConvertValue AttributeValue="#00FF00" SignalMoreOrEqualTo="18.0" SignalLessOrEqualTo="22.0"/>
<ConvertValue AttributeValue="#FF0000" SignalMoreThan="22.0"/>
</Bind>
</Polygon>
</TGML>
Example of other ConvertValue elements on screen: